package com.lzw.ddns.config;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @author liuzw
 * @date 2021/10/30
 */
@Component
public class DDNSConfig {

    @Value("${region.id}")
    private String regionId;
    @Value("${access.key.id}")
    private String accessKeyId;
    @Value("${access.key.secret}")
    private String accessKeySecret;

    @Bean
    public IAcsClient client() {
        // 设置鉴权参数，初始化客户端
        DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
        return new DefaultAcsClient(profile);
    }
}
